// JavaScript Document
function formReset(){
    var x=document.getElementById(form1);
    x.reset()
	return false;
	}

    function calculateArea()
    {
        //alert("function called");
	var count = 20;
	var factor = new Array();
	factor[1]=1; 			//sq.ft
	factor[2]=0.0930000000000000000;//sq.mts
	factor[3]=0.1111111111111000000;//sq.yards
	factor[4]=0.0000229566300000000;//acres
	factor[5]=0.0000092904166000000;//hectares
	factor[6]=0.0000573921030000000;//bigha1
	factor[7]= 0.000002869605100000;//biswa1
	factor[8]= 0.000036730946000000;//bigha2
	factor[9]= 0.000001836547300000;//biswa2
	factor[10]= 0.00138888890000000;//kottah
	//factor[11]= 0.00018521194000000;//kanal
	//factor[12]= 0.00000926059690000;//marla
	factor[11]= 0.00000926059690000;//kanal
	factor[12]= 0.00018521194000000;//marla
	factor[13]= 0.00041666667000000;//ground
	factor[14]= 0.00229600000000000;//cent
	factor[15]= 0.01389088900000000;//aankadam
	factor[16]= 0.00367242010000000;//perch
	factor[17]= 0.00009181050300000;//rood
	factor[18]= 0.00091827364554640;//guntha
	factor[19]= 0.002222222222222223;//chatak
	factor[20]= 0.00092936802973000;//are
	 var element =  new Array();
	element[1]= document.getElementById("txtSqrFeet").value;
	element[2]= document.getElementById("txtSqrMeter").value;
	element[3]= document.getElementById("txtSqrYard").value;
	element[4]= document.getElementById("txtAcres").value;
	element[5]= document.getElementById("txtHect").value;
	element[6]= document.getElementById("txtBigha1").value;
	element[7]= document.getElementById("txtBiswa1").value;
	element[8]= document.getElementById("txtBigha2").value;
	element[9]= document.getElementById("txtBiswa2").value;
	element[10]= document.getElementById("txtKottah").value;
	element[11]=document.getElementById("txtKanal").value;
	element[12]=document.getElementById("txtMarla").value;
	element[13]= document.getElementById("txtGrounds").value;
	element[14]= document.getElementById("txtCents").value;
	element[15]= document.getElementById("txtAanKadam").value;
	element[16]= document.getElementById("txtPerch").value;
	element[17]= document.getElementById("txtRood").value;
	element[18]= document.getElementById("txtGuntha").value;
	element[19]= document.getElementById("txtChataks").value;
	element[20]= document.getElementById("txtAres").value;

	var firstvalue =0, position =0, nullcount=0;
    for (var i=1; i <= count; i++)
	{
		if(element[i] != null && element[i].length!=0)
		{
			if(i==1 && element[2]!="")
			var parsecheck=""+parseFloat(element[i]);
			if(parseFloat(element[i])==0 || parsecheck=="NaN")
			{
				window.alert("Please Enter a Non-Zero Number");
				return false;

			}
			firstvalue=element[i]/factor[i];
			position= i;
			value=element[i];
			break;
		}
		else
		{
		nullcount=nullcount+1
		}
		if (nullcount==count)
		{
		window.alert("Please enter a value.")
		return false;
		}

	}
	if (firstvalue==0)
	{
		clearForm1();
	}
		document.getElementById("txtSqrFeet").value=firstvalue*factor[1];
		document.getElementById("txtSqrMeter").value=firstvalue*factor[2];
		document.getElementById("txtSqrYard").value=firstvalue*factor[3];
		document.getElementById("txtAcres").value=firstvalue*factor[4];
		document.getElementById("txtHect").value=firstvalue*factor[5];
		document.getElementById("txtBigha1").value=firstvalue*factor[6];
		document.getElementById("txtBiswa1").value=firstvalue*factor[7];
		document.getElementById("txtBigha2").value=firstvalue*factor[8];
		document.getElementById("txtBiswa2").value=firstvalue*factor[9];
		document.getElementById("txtKottah").value=firstvalue*factor[10];
		document.getElementById("txtKanal").value=firstvalue*factor[11];
		document.getElementById("txtMarla").value=firstvalue*factor[12];
		document.getElementById("txtGrounds").value=firstvalue*factor[13];
		document.getElementById("txtCents").value=firstvalue*factor[14];
		document.getElementById("txtAanKadam").value=firstvalue*factor[15];
		document.getElementById("txtPerch").value=firstvalue*factor[16];
		document.getElementById("txtRood").value=firstvalue*factor[17];
		document.getElementById("txtGuntha").value=firstvalue*factor[18];
		document.getElementById("txtChataks").value=firstvalue*factor[19];
		document.getElementById("txtAres").value=firstvalue*factor[20];
		
        if(document.getElementById("txtSqrFeet").value<0.00000001)
        {
        document.getElementById("txtSqrFeet").value
        }
        if(document.getElementById("txtSqrMeter").value<0.00000001)
        {
        document.getElementById("txtSqrMeter").value="0";
        }
        if(document.getElementById("txtSqrYard").value<0.00000001)
        {
        document.getElementById("txtSqrYard").value="0";
        }
        if(document.getElementById("txtAcres").value<0.00000001)
        {
        document.getElementById("txtAcres").value="0";
        }
        if(document.getElementById("txtHect").value<0.00000001)
        {
        document.getElementById("txtHect").value="0";
        }
        if(document.getElementById("txtBigha1").value<0.00000001)
        {
        document.getElementById("txtBigha1").value="0";
        }
        if(document.getElementById("txtBiswa1").value<0.00000001)
        {
        document.getElementById("txtBiswa1").value="0";
        }
        if(document.getElementById("txtBigha2").value<0.00000001)
        {
        document.getElementById("txtBigha2").value="0";
        }
        if(document.getElementById("txtBiswa2").value<0.00000001)
        {
        document.getElementById("txtBiswa2").value="0";
        }
        if(document.getElementById("txtKottah").value<0.00000001)
        {
        document.getElementById("txtKottah").value="0";
        }
        if(document.getElementById("txtKanal").value<0.00000001)
        {
        document.getElementById("txtKanal").value="0";
        }
        if(document.getElementById("txtMarla").value<0.00000001)
        {
        document.getElementById("txtMarla").value="0";
        }
        if(document.getElementById("txtGrounds").value<0.00000001)
        {
        document.getElementById("txtGrounds").value="0";
        }
        if(document.getElementById("txtCents").value<0.00000001)
        {
        document.getElementById("txtCents").value
        }
        if(document.getElementById("txtAanKadam").value<0.00000001)
        {
        document.getElementById("txtAanKadam").value="0";
        }
        if(document.getElementById("txtPerch").value<0.00000001)
        {
        document.getElementById("txtPerch").value="0";
        }
        if(document.getElementById("txtRood").value<0.00000001)
        {
        document.getElementById("txtRood").value="0";
        }
        if(document.getElementById("txtGuntha").value<0.00000001)
        {
        document.getElementById("txtGuntha").value="0";
        }
        if(document.getElementById("txtChataks").value<0.00000001)
        {
        document.getElementById("txtChataks").value
        }
        if(document.getElementById("txtAres").value<0.00000001)
        {
        document.getElementById("txtAres").value="0";
        }


        if(document.getElementById("txtSqrFeet").value>9999999999)
        {
        document.getElementById("txtSqrFeet").value="-";
        }
        if(document.getElementById("txtSqrMeter").value>9999999999)
        {
        document.getElementById("txtSqrMeter").value="-";
        }
        if(document.getElementById("txtSqrYard").valu>9999999999)
        {
        document.getElementById("txtSqrYard").valu="-";
        }
        if(document.getElementById("txtAcres").value>9999999999)
        {
        document.getElementById("txtAcres").value="-";
        }
        if(document.getElementById("txtHect").value>9999999999)
        {
        document.getElementById("txtHect").value="-";
        }
        if(document.getElementById("txtBigha1").value>9999999999)
        {
        document.getElementById("txtBigha1").value="-";
        }
        if(document.getElementById("txtBiswa1").value>9999999999)
        {
        document.getElementById("txtBiswa1").value="-";
        }
        if(document.getElementById("txtBigha2").value>9999999999)
        {
        document.getElementById("txtBigha2").value="-";
        }
        if(document.getElementById("txtBiswa2").value>9999999999)
        {
        document.getElementById("txtBiswa2").value="-";
        }
        if(document.getElementById("txtKottah").value>9999999999)
        {
        document.getElementById("txtKottah").value="-";
        }
        if(document.getElementById("txtKanal").value>9999999999)
        {
        document.getElementById("txtKanal").value="-";
        }
        if(document.getElementById("txtMarla").value>9999999999)
        {
        document.getElementById("txtMarla").value="-";
        }
        if(document.getElementById("txtGrounds").value>9999999999)
        {
        document.getElementById("txtGrounds").value="-";
        }
        if(document.getElementById("txtCents").value>9999999999)
        {
        document.getElementById("txtCents").value="-";
        }
        if(document.getElementById("txtAanKadam").value>9999999999)
        {
        document.getElementById("txtAanKadam").value
        }
        if(document.getElementById("txtPerch").value>9999999999)
        {
        document.getElementById("txtPerch").value="-";
        }
        if(document.getElementById("txtRood").value>9999999999)
        {
        document.getElementById("txtRood").value="-";
        }
        if(document.getElementById("txtGuntha").value>9999999999)
        {
        document.getElementById("txtGuntha").value="-";
        }
        if(document.getElementById("txtChataks").value>9999999999)
        {
        document.getElementById("txtChataks").value="-";
        }
        if(document.getElementById("txtAres").value>9999999999)
        {
        document.getElementById("txtAres").value="-";
        }
		return false;
     }
    function clearForm1()
    {
      document.form1.reset();
	  return false;
    }   